package  {
	import flash.display.Sprite;
	import org.papervision3d.objects.primitives.Cube;
	
	public class BannerDisplayer extends Sprite  {
		
		private var _cubes:Array = [];
		private var _bannerWidth:Number = 0; 
		private var _cubeWidth:Number;
		private var _currentX:Number;
		private var _currentRotation:Number;
		private var _myCube:Cube;
		
		public function BannerDisplayer(cubes:Array,width:Number):void {
			
			//fill cubes with passed in variable 
			_cubes = cubes;
			_cubeWidth = width;
			
			//loop through array to figure out total bannder width
			for (var i = 0; i < _cubes.length; i++) {
				_bannerWidth += _cubeWidth;
			}
			
			//offset x by half off array
			_currentX -= (_bannerWidth / 2);
			
			//loop through cubes and set x and rotationX 
			for (var j = 0; j < _cubes.length; j++) {
				_cubes[j].x = _currentX;
				_currentX += _cubeWidth;
			}
		}
		
		public function get cubes():Array {
			return _cubes;
		}
	}	
}